import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QVBoxLayout, QTextEdit

def init_widget(w: QWidget):
    w.setWindowTitle("多行输入框")
    w.resize(640, 480)
    
    layout = QVBoxLayout()
    username_edit = QLineEdit()
    username_edit.setPlaceholderText("输入姓名")
    username_edit.setText("jackluo")
    username_edit.setMaxLength(12)
    layout.addWidget(username_edit)
    
    text_edit = QTextEdit()
    text_edit.setPlaceholderText("请输入个人简介")
    text_edit.setPlainText("<font color = 'red'>adc</font>")
    
    print(text_edit.toPlainText())
    text_edit.clear()
    
    layout.addWidget(text_edit)
    
    w.setLayout(layout)
    
if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = QWidget()
    init_widget(w)
    w.show()
    sys.exit(app.exec_())
    
